<link rel="stylesheet" href="../component/bootstrap/css/bootstrap-tagsinput.css">

<div class="news-flash-content">
    <blockquote class="layui-elem-quote">
        <button class="layui-btn create-item"><i class="layui-icon">&#xe654;</i>添加快讯</button>
    </blockquote>
    <form class="layui-form" lay-filter="searchNewsFlashForm">
        <div class="layui-form-item">
            <label class="layui-form-label">快讯标题</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="title" placeholder="请输入标题" class="layui-input"
                       lay-filter="searchNewsFlashForm">
            </div>
            <!--<label class="layui-form-label">糖果数</label>
            <div class="layui-input-block layui-col-md2 no-margin-left">
                <input type="number" name="candy" placeholder="请输入糖果数" class="layui-input" lay-verify="integer"
                       lay-filter="searchNewsFlashForm">
            </div>-->
            <!--<label class="layui-form-label">过期时间</label>
            <div class="layui-input-block layui-col-md2 no-margin-left">
                <input type="number" name="expireTime" placeholder="请输入过期时间(单位小时)" class="layui-input"
                       lay-verify="integer"
                       lay-filter="searchNewsFlashForm">
            </div>-->
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">上线状态</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <select name="status" class="layui-input">
                    <option value="" selected>全部</option>
                    <option value="00" >下线</option>
                    <option value="01" >上线</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">创建时间</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="createTime" placeholder="创建时间范围" class="layui-input range-input"
                       lay-filter="searchNewsFlashForm" readonly>
            </div>
            <input class="layui-btn search" type="button" value="搜索" lay-submit lay-filter="searchNewsFlashForm"/>
        </div>
    </form>

    <div class="news-flash-table"></div>
    <script type="text/html" id="news-flashForm">
        <form class="layui-form padding-5 layui-dialog news-flash-form">
            <div class="layui-form-item">
                <label class="layui-form-label required">标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                           autocomplete="off" value="{{d.data.title||''}}"
                           class="layui-input">
                </div>
            </div>

           <!-- <div class="layui-form-item">
                <label class="layui-form-label required">糖果数：</label>
                <div class="layui-input-block">
                    <input type="number" name="candy" required lay-verify="required|positiveInteger"
                           autocomplete="off" value="{{d.data.candy||''}}"
                           class="layui-input">
                </div>
            </div>-->

            <!--<div class="layui-form-item">
                <label class="layui-form-label required">失效时间：</label>
                <div class="layui-input-inline">
                    <input type="number" name="expireTime" placeholder="失效时间"
                           lay-verify="required|positiveInteger|expireTime"
                           autocomplete="off" value="{{d.data.expireTimeInHour || ''}}"
                           class="layui-input">
                </div>
                <div class="layui-input-inline line-height-38">小时</div>
            </div>-->
            <div class="layui-form-item">
                <label class="layui-form-label required">紧急程度：</label>
                <div class="layui-input-inline">
                    <select name="emergency">
                        <option value="01" {{# if(d.data.emergency=="01"){}}selected{{#}}}>一般</option>
                        <option value="02" {{# if(d.data.emergency=="02"){}}selected{{#}}}>紧急</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上线状态</label>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="01"  {{# if(d.data.status=="01"){}}selected{{#}}}>上线</option>
                        <option value="00"  {{# if(d.data.status=="00"){}}selected{{#}}} >下线</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">内容：</label>
                <div class="layui-input-block">
                    <textarea name="content" placeholder="请输入内容"
                              class="layui-textarea textarea-limit">{{d.data.content||''}}</textarea>
                    <span class="textarea-status">
                        {{#if(d.data.content){}}{{d.data.content.length}}/500{{#}}}
                    </span>
                </div>

            </div>

            {{# if(d.model=='addNewsFlashForm'){}}
            <div class="layui-form-item">
                <label class="layui-form-label">附图：</label>
                <div class="layui-input-block cover-container">
                    <div class="add-cover-btn">
                        <span class="add-icon">+</span>
                    </div>
                </div>
            </div>
            {{# }else{}}
            <div class="layui-form-item">
                <label class="layui-form-label">附图：</label>
                <div class="layui-input-block cover-container">
                    {{# layui.each(d.data.imageArray, function(index, item){ }}
                    <div class="cover">
                        <i class="layui-icon remove-cover">&#x1007;</i>
                        <input type="hidden" name="cover" required lay-verify="required"
                               autocomplete="off" value="{{item||''}}"
                               class="layui-input show-uploader">
                        <img src="{{item||''}}" class="cover-item"/>
                    </div>
                    {{# }); }}

                    <div class="add-cover-btn" {{#if(d.data.imageArray.length>= 3){}}style="display:none;"{{#}}}>
                        <span class="add-icon">+</span>
                    </div>
                </div>
            </div>
            {{#}}}
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn save" lay-submit lay-filter="{{d.model}}">保存</button>
                    <button type="reset" class="layui-btn">重置</button>
                </div>
            </div>
            <input type="hidden" name="id" value="{{d.data.id||''}}"/>
            <input type="hidden" name="channelId" value="7"/>
        </form>
    </script>
</div>

<script src="../component/bootstrap/js/bootstrap-tagsinput.min.js"></script>
<script type="text/javascript" src="../js/news-flash.js"></script>